<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<c:set var="uri" value="${pageContext.request.contextPath}" />
    <script type="text/javascript">
    var uri='${uri}';
        </script>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <title>修改-员工</title>
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/layui/css/layui.css">
        
                  		 	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/common/selectSearch/jquery.searchableSelect.css" />
                  		 	
            <style type="text/css">
            .loadingModel {
                position: absolute;
                top: 0;
                left: 0;
                display: none;
                background-color: rgba(9, 9, 9, 0.63);
                width: 100%;
                height: 100%;
                z-index: 1000;
            }
            .loading-content {
                width: 50%;
                text-align: center;
                background: #ffffff;
                border-radius: 6px;
                line-height: 30px;
                z-index: 10001;
            }
            </style>
            </head>
            <div id="loadingDiv"></div>
            <div id="imgModal"></div>
            <div class="layui-container" style="overflow:hidden;height:2000px">
            <div class="layui-row">
            <div class="layui-col-lg12">
            <fieldset class="layui-elem-field">
            <legend>修改-员工</legend>
            <div class="layui-field-box">
            <div >
            
            	 <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">员工名</label>
            <div class="layui-input-block">
          			
                  	<input type="text"   style="width:500px;display:inline"  placeholder="请输入员工名" id="staffName" value="${data.staffName}" class="layui-input">
             
            </div>
            </div>
            
            	 <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-block">
          			
                  <select  id="sex"  style="width:500px;display:inline;height:30px" >
              <c:forEach var="item" items="${sex}">
<c:if test="${data.sex==item.id}">
	<option value="${item.id}" selected>${item.name}</option>
</c:if>
<c:if test="${data.sex!=item.id}">
	<option value="${item.id}">${item.name}</option>
</c:if>
</c:forEach>
</select>

            </div>
            </div>
            
            	 <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">联系电话</label>
            <div class="layui-input-block">
          			
                  	<input type="text"   style="width:500px;display:inline"  placeholder="请输入联系电话" id="celPhone" value="${data.celPhone}" class="layui-input">
             
            </div>
            </div>
            
            	 <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">所属部门</label>
            <div class="layui-input-block">
          			
                  		 	 <select  id="departId" style="height:30px;width:500px;display:inline"  >
                  		 <c:forEach var="item" items="${departInfo}">
<c:if test="${data.departId==item.id}">
	<option value="${item.id}" selected>${item.departName}</option>
</c:if>
<c:if test="${data.departId!=item.id}">
	<option value="${item.id}">${item.departName}</option>
</c:if>
</c:forEach>
</select>

            </div>
            </div>
            
            	 <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">籍贯</label>
            <div class="layui-input-block">
          			
                  	<input type="text"   style="width:500px;display:inline"  placeholder="请输入籍贯" id="city" value="${data.city}" class="layui-input">
             
            </div>
            </div>
            
            
                    <div class="layui-form-item">
                    <div class="layui-input-block">
                    <button class="layui-btn" onclick="submitData();" >立即提交</button>
                    <button  class="layui-btn layui-btn-primary"  onclick="javascript:history.back(-1);" >返回</button>
                    </div>
                    </div>
                    </div>
                    </div>
                    </fieldset>
                    </div>
                    </div>
                    </div>
                    <script type="text/javascript" src="${pageContext.request.contextPath}/static/common/jquery-1.11.1.min.js"></script>
                        <script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui/layui.js"></script>
                            <script type="text/javascript" src="${pageContext.request.contextPath}/static/common/utils/listutils.js?v=4684"></script>
                                
                  		 	 <script type="text/javascript" src="${pageContext.request.contextPath}/static/common/selectSearch/jquery.searchableSelect.js"></script>
                  		 	
                                        <script type="text/javascript">
                                        $(function(){
                                            
                  		 	  $('#departId').next().remove();
                              $('#departId').searchableSelect();
                  		 	
                                        })
                                        
                                        
                                        function submitData(){
											var staffName=$("#staffName").val();
var sex=$("#sex").val();
var celPhone=$("#celPhone").val();
var departId=$("#departId").val();
var city=$("#city").val();
                                            
                                            $.ajax({
                                                type: 'post',
                                                url: 'AdminStaffServlet?method=updateSubmit',
                                                    data:{
                                                      "staffName":staffName,
"sex":sex,
"celPhone":celPhone,
"departId":departId,
"city":city,
"id":'${data.id}'

                                                    },
                                                    success: function(result) {
                                                    	result=$.parseJSON(result);
                                                        if(result.code == 0){
                                                            alert(result.msg);
                                                            }else{
                                                                alert(result.msg);
                                                                self.location=document.referrer;
                                                            }
                                                        }
                                                    });
                                                }
                                                </script>
                                                </body>
                                                </html>
